package io.renren.config;



/**
 * @Description: 基类异常信息
 */
public class BusinessException extends RuntimeException {

    private String code;

    private String message;

    public BusinessException(String code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public BusinessException(String message) {
        super(message);
        this.code = CommonConstant.ERROR;
        this.message = message;
    }

    /**
     * 自定义异常
     * @param enums 异常的枚举类型
     */
    public BusinessException(ErrorCodeEnum enums) {
        super(enums.getDescription());
        this.code = enums.getCode();
        this.message = enums.getDescription();
    }

    /**
     * 自定义的系统异常类型
     * @param enums
     */
    public BusinessException(ResponseCodeEnum enums) {
        super(enums.getMessage());
        this.code = enums.getCode();
        this.message = enums.getMessage();
    }

	public String getCode() {
		return code;
	}

	@Override
	public String getMessage() {
		return message;
	}
}
